package com.wyn.common.controller;


import com.wyn.common.utils.RedisUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@Slf4j
@RequestMapping("/redis")
@RestController
@Api(tags = {"Redis测试管理控制器"})
public class RedisController {


    @Resource
    private RedisUtil redisUtil;

    @PostMapping("set")
    public boolean redisSet(String key, String value){
        System.out.println(key+"--"+value);
        return redisUtil.set(key,value);
    }

    @GetMapping("get")
    public Object redisGet(String key){
        System.out.println(redisUtil.get(key));
        return redisUtil.get(key);
    }

    @GetMapping("expire")
    public boolean expire(String key,long ExpireTime){
        return redisUtil.expire(key,ExpireTime);
    }
}
